<?php

    class gpersonal_informacion_cv 
    {
        public $sql;
        
        function gpersonal_informacion_cv() 
        {
            $this->sql = new DmpSql();
        }

        function nueva_informacion_cv ( $idpersonal, $idinformacion_cv_categ, $descripcion, $visible, $comentario = null )
        {
            $consulta = "INSERT INTO personal_informacion_cv
                         SET idpersonal='".$idpersonal."',
                         idinformacion_cv_categ='".$idinformacion_cv_categ."',
                         descripcion='".$descripcion."',
                         visible='".$visible."',
                         comentario='".$comentario."'";
                            
            $error = 0;
            if ( !$this->sql->consultar($consulta, "sigh") ) 
            {
                $error++;
            }
            
            if($error == 0)
            {
                $this->sql->consultar("COMMIT","sigh");
                return true;
            }
            else
            {
                $this->sql->consultar("ROLLBACK","sigh");
                return false;
            }
        }
        
        function actualiza_informacion_cv ( $idpersonal_informacion_cv, $idpersonal, $idinformacion_cv_categ, $descripcion, $visible, $comentario = null )
        {
            $consulta = "UPDATE personal_informacion_cv
                         SET idpersonal='".$idpersonal."',
                         idinformacion_cv_categ='".$idinformacion_cv_categ."',
                         descripcion='".$descripcion."',
                         visible='".$visible."',
                         comentario='".$comentario."'
                         WHERE idpersonal_informacion_cv='".$idpersonal_informacion_cv."'";
            
            //echo($consulta."<br /><br />");
            $error = 0;
            if ( !$this->sql->consultar($consulta, "sigh") ) 
            {
                $error++;
            }
            
            if($error == 0)
            {
                $this->sql->consultar("COMMIT","sigh");
                return true;
            }
            else
            {
                $this->sql->consultar("ROLLBACK","sigh");
                return false;
            }         
        } 
        
        function eliminar_informacion_cv ( $idpersonal_informacion_cv )
        {
            $consulta = "DELETE FROM personal_informacion_cv
                         WHERE idpersonal_informacion_cv='".$idpersonal_informacion_cv."'";
            
            $error = 0;
            if ( !$this->sql->consultar($consulta, "sigh") ) 
            {
                $error++;
            }
            
            if($error == 0)
            {
                $this->sql->consultar("COMMIT","sigh");
                return true;
    
            }
            else
            {
                $this->sql->consultar("ROLLBACK","sigh");
                return false;
            }
        }
    }

?>